const pattern = /[a-zA-Z0-9_\u0392-\u03C9\u00C0-\u00FF\u0600-\u06FF\u0400-\u04FF]+|[\u4E00-\u9FFF\u3400-\u4DBF\uF900-\uFAFF\u3040-\u309F\uAC00-\uD7AF]+/g

export function countWord(data: string) {
  const m = data.match(pattern)
  let count = 0
  if (m) {
    for (const element of m) {
      count += element.charCodeAt(0) >= 0x4e00 ? element.length : 1
    }
  }
  return count
}
